<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<script type="text/javascript" >

$(function(){
	$('#taskGrid').datagrid({
	    url: ctx + '/wfc/Task!findByPage.action',
	    singleSelect: true,
	    fit: true,
	    toolbar:'#button_index',
	    pagination: true,
	    rownumbers: true,
	    idField: 'sid',
	    onDblClickRow :function(rowIndex,rowData){
	    	CQOA.load('extendDiv',ctx+'/work/register.action',{'dto.taskId':rowData.sid},function(){
				CQOA.hideDiv('mainDiv');
				CQOA.showDiv('extendDiv');
			});
	    }
	});
	
	
	
	
	$('#scname').searchbox({
	    searcher:function(value,name){
	    	$('#taskGrid').datagrid('reload',{
	    		'entity.cname':value
	    	});
	    },
	    prompt:'请输入岗位名称'
	});
	
	
	$('#taskDel').bind('click',function(){
		var row = $('#taskGrid').datagrid('getSelected');
		if (!row) {
			$.messager.show({
				msg : '请选择一条数据'
			});
			return false;
		}
		$.messager.confirm('提示信息','你确定要删除这条数据?',function(s){
			if(s){
				postcommit(ctx+'/work/clearTaskData.action',{'dto.taskId':row.sid},function(o){
					if(o.success){
						$('#taskGrid').datagrid("unselectAll");
						$('#taskGrid').datagrid('reload');
					}
					$.messager.show({
						msg : o.msg
					});
				});
			}
		});
	});
	
});


function comeback(){
	CQOA.hideDiv('extendDiv');
	CQOA.showDiv('mainDiv');
};


</script>
<div id="mainDiv" class="easyui-layout" fit="true" border="false">
	        <div id="easyui-title" style="display:none">
	            	代办任务
	        </div>
            <div class="searchDiv" region="north" border="false" style="text-align: center;">
            		<input id="scname" style="width:300px" ></input>
            </div>
            <div id="button_index" class="top_toolbar_button_div" border="false">
                    <a href="#" class="easyui-linkbutton" iconCls="icon-remove" id="taskDel">删除</a>
            </div>
            <div  region="center" border="false">
	           <table id="taskGrid" title="任务列表" border="false" fit="true" >
	               			<thead>
			                   <tr>
			                      <!-- <th field="sid"  width="50">SID</th> -->
			                      <th field="title"  width="400">标题</th>
			                      <th field="sendCname"  width="200">发送人</th>
			                      <th field="beginTime"  width="200">发送时间</th>
			                      <th field="cname"  width="200">当前活动</th>
			                   </tr>
	               			</thead>
	       	 	</table>
           </div>
</div>
<div id="extendDiv" class="easyui-panel" style="display:none;" fit="true" border="false"></div>
<div id="targetPopup" modal="true" class="easyui-window" closed="true" style="height: 480px; width: 700px" title="选择人员"></div>


